package cn.chenlh.fx.test.componant;

import cn.chenlh.fx.component.FilteredSelect;
import cn.chenlh.fx.pojo.ListItem;
import cn.chenlh.fx.test.pojo.Users;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

public class FilteredSelectTest2 extends TestBase {
    @Override
    protected void init(Stage stage, StackPane root, Scene scene) {
        var listItems = ListItem.listOf(Users::getLabel,
                new Users(88, "changlie"),
                new Users(12, "天气"),
                new Users(12, "管仲OK"),
                new Users(9, "灰谷")
        );
        var select = new FilteredSelect<>(listItems);
        select.onSelect(u -> {
            System.out.println("selected: "+u);
        });

        root.getChildren().add(select);
    }

}
